#%RAML 1.0
title: User Groups
version: v1.0
baseUri: http://github.com/org/folio/mod-users

documentation:
  - title: mod-users Departments API
    content: This documents the API calls that can be made to query and manage departments of the system

types:
  department: !include department.json
  departmentCollection: !include departmentCollection.json
  errors: !include raml-util/schemas/errors.schema

traits:
  searchable: !include raml-util/traits/searchable.raml
  pageable: !include raml-util/traits/pageable.raml
  validate: !include raml-util/traits/validation.raml
  language: !include raml-util/traits/language.raml

resourceTypes:
  collection: !include raml-util/rtypes/collection.raml
  collection-item: !include raml-util/rtypes/item-collection.raml

/departments:
  type:
    collection:
      exampleCollection: !include examples/departmentCollection.sample
      exampleItem: !include examples/department.sample
      schemaCollection: departmentCollection
      schemaItem: department
  get:
    is: [
      searchable: {description: "", example: "attributes.code==\"*acc*\""},
      pageable
    ]
    description: Return a list of departmants
  post:
    is: [validate]
    description: Create a departmant
  /{departmentId}:
    uriParameters:
      departmentId:
        pattern : "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
    type:
      collection-item:
        exampleItem: !include examples/department.sample
        schema: department
    put:
      is: [validate]
